home *** CD-ROM | disk | FTP | other *** search
- Path: kbad.eglin.af.mil!rpi!not-for-mail
- From: thp@cs.ucr.edu (Tom Payne)
- Newsgroups: comp.lang.c++.moderated,comp.lang.c++
- Subject: Re: Meaning of the specifier volatile?
- Date: 8 Jan 1996 15:49:29 -0000
- Organization: University of California, Riverside Department of Computer Science
- Sender: cppmods@netlab.cs.rpi.edu
- Approved: Dietmar.Kuehl@uni-konstanz.de
- Message-ID: <4cree9$9bv@netlab.cs.rpi.edu>
- References: <4c9740$27n@netlab.cs.rpi.edu> <4cff74$gfj@netlab.cs.rpi.edu> <4cj5u4$qjm@netlab.cs.rpi.edu>
- NNTP-Posting-Host: netlab.cs.rpi.edu
-
- X-Original-Date: 6 Jan 1996 21:57:16 GMT
-
- J. Kanze (kanze@gabi-soft.fr) wrote:
- [stuff deleted]
- : On point concerning volatile that I have not seen made is the fact that
- : the C/C++ concept of volatile is orthogonal to atomicity of access.
- : Declaring an object volatile is *NOT* sufficient with regards to
- : asynchronous events; the object must still be of a type for which the
- : compiler will generate atomic accesses.
- [stuff deleted]
-
- Because of the signal-handlers-can't-read provision of the ANSI C
- standard, atomicity is unnecessary in the coordination of asynchronous
- activity for programs with defined behavior:
-
- * signal handlers won't read any partially written non-atomic
- shared variables, because they are not allowed to read variables
- of static storage class in programs with defined behavior.
-
- * the program itself won't read any partially written non-atomic
- shared varible, because signal handlers don't return control
- until they have completed their writes of volatile variables.
-
- With pre-emptive multithreading, of course, the possibility of
- pre-emption during a non-atomic write requires atomicity of some
- coordination variables, but it's impossible to introduce
- multithreading and stay within defined behavior per the ANSI
- standard.
-
- Tom Payne (thp@cs.ucr.edu)
-
- [ comp.lang.c++.moderated is a moderated newsgroup. Submit articles ]
- [ to <c++-submit@netlab.cs.rpi.edu>. The moderation policy can be ]
- [ retrieved from <http://netlab.cs.rpi.edu/~cppmods/guide.html>. ]
- [ Moderators can be reached at: c++-request@netlab.cs.rpi.edu. ]
-